/**
 * @description 页面模板数据
 * @author FFFF
 */

import { reactive } from 'vue'
export const generateDataJson = reactive({
    data: {
        type: "page",
        id: "root",
        label: "页面",
        layout: "flow", // 布局类型   
        width: "100%",
        height: "100%",
        icon: "FileOutlined",
        // 组件列表
        children: [],
        // 外层布局的参数 样式
        componentProps: {
            style: {
                padding: "30px",
                width: "100%",
                height: "100%"
            }
        }
    },
    script: "const { dcDefineExpose, pageData, getComponents } = this;\n\nfunction test() {\n    console.log('test')\n}\n\n// 通过ID获取组件示例\nfunction getComponentById() {\n    let item = getComponents('inputNumber_02'); // 获取组件\n    item.setValue('8888');             // 组件赋值\n    let itemValue = item.getValue();   // 获取组件的值\n\n    console.log(\"获取的组件：\", item);\n    console.log(\"组件的值：\", itemValue);\n}\n\n// 获取所有组件示例\nfunction getAllComponent() {\n    let arr = getComponents();  // 获取所有组件\n    console.log(\"所有组件：\", arr);\n}\n\nfunction test4() {\n    console.log('test4')\n    alert(\"测试test4函数\")\n}\n\n// 全部隐藏\nfunction allHidden() {\n    // alert(\"测试点击事件\")\n    // componentProps\n    let arr = getComponents();\n\n    for (let i = 0; i < arr.length; i++) {\n        let item = arr[i];\n        if(item.type != \"button\"){\n            item.componentProps.hidden = true;\n        }\n    }\n}\n\n// 全部显示\nfunction allShow() {\n    // alert(\"测试点击事件\")\n    // componentProps\n    let arr = getComponents();\n\n    for (let i = 0; i < arr.length; i++) {\n        let item = arr[i];\n        if(item.type != \"button\"){\n            item.componentProps.hidden = false;\n        }\n    }\n}\n\n// 全部禁用\nfunction allDisabled() {\n    // alert(\"测试点击事件\")\n    // componentProps\n    let arr = getComponents();\n\n    for (let i = 0; i < arr.length; i++) {\n        let item = arr[i];\n        if(item.type != \"button\"){\n            item.componentProps.disabled = true;\n        }\n    }\n}\n\n\n// 全部启用\nfunction allEnable() {\n    // alert(\"测试点击事件\")\n    // componentProps\n    let arr = getComponents();\n\n    for (let i = 0; i < arr.length; i++) {\n        let item = arr[i];\n        if(item.type != \"button\"){\n            item.componentProps.disabled = false;\n        }\n    }\n}\n\n\n\n// 函数编辑或新增后请在下方向外暴露\n// 函数编辑后请点击左下方更新函数的按钮\ndcDefineExpose({\n    test,\n    getComponentById,\n    getAllComponent,\n    allHidden,\n    allShow,\n    allDisabled,\n    allEnable\n})"
});
